#  Name:		uptime
#  Version:		0.4
#  Part Of:		linuxrules
#  Modified:	Sun Nov 21 2010, 13:03:05

#  See COPYING for linuxrules GPL3 licensing info.

BEGIN {
	getline < "/proc/uptime"
	_dys = int($1/86400)
	_hrs = int($1/3600) - (_dys*24)
	_mns = int($1/60) - (_dys*1440) - (_hrs*60)
	_hid = int($2/3600)
	_mid = int($2/60) - (_hid*60 )

	if ( _hid < 10 )
		_hid = "0" _hid

	if ( _mid < 10 )
		_mid = "0" _mid

	if ( _hrs < 10 )
		_hrs = "0" _hrs

	if ( _mns < 10 )
		_mns = "0" _mns

	_proc["UPTIME", 1] = _dys ":" _hrs ":" _mns
    _proc["IDLE"] = _hid ":" _mid
	_proc["UPTIME", 2] = "'" _dys " d, " _hrs ":" _mns " h'"
	_proc["UPTIME", 3] = "'" _dys " days, " _hrs "h " _mns "m'"
	_proc["UPTIME", 4] = "'" _dys " days, " _hrs ":" _mns " hours'"

	close("/proc/uptime")
}

# vim:ft=awk:
